package top.jiangqiang.qyblog.core.init;

import cn.hutool.core.io.FileUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import top.jiangqiang.qyblog.common.config.GlobalProperties;

import java.io.File;

/**
 * 启动成功后的一些必要操作
 *
 * @author Jiangqiang
 * @version 1.0
 * @date 2023/4/26 10:12
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class InitOther implements ApplicationRunner {
    protected final GlobalProperties globalProperties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //启动后初始化缓存目录
        File cacheDir = FileUtil.file(globalProperties.getFileConfig().getCachePath());
        FileUtil.mkdir(cacheDir);
    }
}
